Skip to content

Conversation

jacobtylerwalls
Copy link
Member

@jacobtylerwalls jacobtylerwalls commented Oct 5, 2025

Type of Changes

Type
✨ New feature

Description

Pylint is forbiddingly opinionated and noisy out of the box. For years there has been consensus to "get sane" somehow.

Here's a stab at a design inspired by eslint. Manual testing shows it works.

Provide a list of strings that can be imported from a module on your path. Default is pylint.recommended. It unpacks to a set of enables and disables that we apply before anything else.

Intended to close #3512

We can change the "default" for this setting in 5, once we go through a cycle of verifying that this works and can be customized (e.g. pylint_django.recommended or whatever)

# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt

core: dict[str, set[str]] = {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't love the word "core", I was just trying to avoid "all" which could be confusing as it doesn't entail --enable-all-extensions nor the messages "disabled by default" with the checker setting.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Legacy for 'core' (i.e. pylint prior to pylint 4.0), 'recommended' (current default), extension / all (extension all and enable / all) ? We could add 'google', 'error' ('--error-only'), 'high-confidence' (no inference) and mozzila (although contrary to google I'm not sure there is a conveniant public pylintrc)

"enable": set(),
"disable": {
"duplicate-code",
# add others from issue...
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixme, etc.

This comment has been minimized.

Copy link
Collaborator

@DanielNoord DanielNoord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool idea! Very useful to see a WIP implementation to gather further thoughts for the broader discussion.

If I did a proper full review I'd probably leave some comments about the metavar and _import_attribute. I like _MessageSetsAction!

One big question I have about this implementation is whether we should make the message set a dataclass, object, whatever.
This makes it so that we can do isinstance in the action but more importantly it makes it a little clearer what options are available for these sets and how it should look like. A project trying to create their own message set now has little guidance on how to structure these. If we exposed a simple dataclass that they could instantiate we would avoid this.
Was this something you considered?

@jacobtylerwalls
Copy link
Member Author

Was this something you considered?

Exactly, I figured the datastructure could be polished later. I was racing to get a draft open for discussion :-)

Copy link

codecov bot commented Oct 5, 2025

Codecov Report

❌ Patch coverage is 80.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.95%. Comparing base (8fd96fa) to head (be64d7d).
⚠️ Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
pylint/utils/utils.py 66.66% 3 Missing ⚠️
pylint/config/callback_actions.py 87.50% 1 Missing ⚠️

❌ Your patch check has failed because the patch coverage (80.00%) is below the target coverage (100.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #10619      +/-   ##
==========================================
- Coverage   95.96%   95.95%   -0.02%     
==========================================
  Files         176      177       +1     
  Lines       19470    19490      +20     
==========================================
+ Hits        18684    18701      +17     
- Misses        786      789       +3     
Files with missing lines Coverage Δ
pylint/__init__.py 97.14% <100.00%> (+0.08%) ⬆️
pylint/config/arguments_manager.py 99.45% <ø> (ø)
pylint/lint/base_options.py 100.00% <ø> (ø)
pylint/message_sets.py 100.00% <100.00%> (ø)
pylint/config/callback_actions.py 81.81% <87.50%> (+0.40%) ⬆️
pylint/utils/utils.py 86.86% <66.66%> (-0.44%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

github-actions bot commented Oct 5, 2025

🤖 According to the primer, this change has no effect on the checked open source code. 🤖🎉

This comment was generated for commit be64d7d

Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you told me it was doable in less than 75 lines of code I would not have believed it :D looks great !

into the given stream or stdout.
"""
# If --message-sets is absent, maybe just go ahead and
# set --message-sets=pylint.recommended? or wait until pylint 5?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I trust that what we can devise now is still better than the current default. (But we can wait for 5 too)

# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt

core: dict[str, set[str]] = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Legacy for 'core' (i.e. pylint prior to pylint 4.0), 'recommended' (current default), extension / all (extension all and enable / all) ? We could add 'google', 'error' ('--error-only'), 'high-confidence' (no inference) and mozzila (although contrary to google I'm not sure there is a conveniant public pylintrc)

# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED
# confidence=

message-sets=pylint.recommended
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the name 'message sets' a lot. Maybe it's because I'd want to put everything inside this (option, message, extension, ... Except things like '--rc-file' or '--version', which will force us to think about it), so I would call it 'style' instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disable certain messages by default
3 participants